﻿<%@ Application Language="VB" %>
<%@ Import Namespace="Cls_Common" %>
<%@ Import Namespace="SecurityService" %>
<script runat="server">
    Private Shared ReadOnly log As log4net.ILog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType)
    Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs)
        ' Code that runs on application startup
        Application("OnlineUsers") = 1
        RegisterRouters(System.Web.Routing.RouteTable.Routes)
    End Sub
    
    Sub RegisterRouters(ByVal routers As System.Web.Routing.RouteCollection)
        routers.MapPageRoute("trangchu", "Index.html", "~/index.aspx")
        
    End Sub
    Sub Application_End(ByVal sender As Object, ByVal e As EventArgs)
        ' Code that runs on application shutdown
    End Sub
        
    Sub Application_Error(ByVal sender As Object, ByVal e As EventArgs)
      
    End Sub

    
    Sub Session_Start(ByVal sender As Object, ByVal e As EventArgs)
        ' Code that runs when a new session is started
        Session("UserName") = Nothing
        Session("UserID") = Nothing
        Session("RoleID") = Nothing
        Session("MenuId") = Nothing
        Session("UserCode") = Nothing
        Session("LanguageId") = 1
        Session("LastLogin") = Now
        
        Application.Lock()
        Application("OnlineUsers") = CType(Application("OnlineUsers"), Integer) + 1
        Application.UnLock()
        
    End Sub

    Sub Session_End(ByVal sender As Object, ByVal e As EventArgs)
        ' Code that runs when a session ends. 
        ' Note: The Session_End event is raised only when the sessionstate mode
        ' is set to InProc in the Web.config file. If session mode is set to StateServer 
        ' or SQLServer, the event is not raised.
        Session("UserName") = Nothing
        Session("MenuId") = Nothing
        Session("UserCode") = Nothing
    End Sub
       
</script>